<?php
namespace app\admin\controller;
// use app\index\
class Page extends Base
{
    public function index()
    {
        $fid=request()->param('fid');       
        $article=db("channel_page");
        $channel=db("channel");
        $where['status']=1;
        $where['cid']=$fid;

        $mess=$article->where($where)->find();

        $fname=$channel->where("id",$fid)->value("name");

        $this->assign("fid",$fid);
        $this->assign("fname",$fname);
        $this->assign("mess",$mess);
		return view('index');
    }
    public function aboutAddDone()
    {
        $updid=request()->param('updid'); 
        $data=$_POST;
        $data['aid']=$this->userMsg['id'];
        if($updid){
            $res=db("channel_page")->where("id",$updid)->update($data);
        }else{
            $res=db("channel_page")->insert($data);
        }

        if($res){   
            $mess['code']=200;
            $mess['msg']='保存成功';
        }else{
            $mess['code']=100;
            $mess['msg']='保存失败';
        }        
        return json_encode($mess);
    }    
}
